<?php
declare (strict_types = 1);

namespace app\api\controller;

use app\BaseController;
use think\facade\Db;

class Upload extends BaseController
{
    public function upload()
    {
        header("Content-Type:text/html;charset=utf-8");
        $data = $this->_vali([
            'name.default'     => '',
        ],'POST');
        
        
        $file = request()->file('file');
        // 上传到本地服务器
        $savename = \think\facade\Filesystem::putFile( 'topic', $file);
        
        if($savename) {
            return json(['status'=>200,'data'=>$savename ]);
        }
    }
}
